﻿using System;
using Microsoft.SmallBasic.Library;
using SmallBasicFun;

namespace DigiFlower
{
    public class DigiFlower
    {
        public static void Main()
        {
            //Show the tortoise
            Tortoise.Show();

            //Make the tortoise move as fast as possible
            Tortoise.SetSpeed(10);
            //Make the background silver
            ProgramWindow.SetBackgroundColor(Colors.Silver);

            //Make the line the tortoise draws 3 pixels wide
            Tortoise.SetPenWidth(3);
            //CreateColorPalette (recipe below)
            CreateColorPalette();

            int count = 100;
            //Do the following 15 times
            for (int i = 0; i < count; i++)
            {
                // DrawOctogon (recipe below)
                DrawOctogon();
                // Turn the tortoise 1/15th of 360 degrees to the right
                Tortoise.Turn(360 / count);
                //Repeat
            }

        }

        public static void CreateColorPalette()
        {
            //------------- Recipe for CreateColorPalette

            // Color 1 is red
            var color1 = Colors.Red;

            // Color 2 is dark orange
            var color2 = Colors.DarkOrange;
            // Color 3 is gold
            var color3 = Colors.Gold;
            // Color 4 is yellow
            var color4 = Colors.Yellow;
            // Add color 1 to the color wheel
            ColorWheel.AddColor(color1);
            // Add color 2 to the color wheel
            ColorWheel.AddColor(color2);
            // Add color 3 to the color wheel
            ColorWheel.AddColor(color3);
            // Add color 4 to the color wheel
            ColorWheel.AddColor(color4);
            // Add color 4 to the color wheel
            ColorWheel.AddColor(color4);
            // Add color 3 to the color wheel
            ColorWheel.AddColor(color3);
            // Add color 2 to the color wheel
            ColorWheel.AddColor(color2);
            // Add color 1 to the color wheel
            ColorWheel.AddColor(color1);

        }

        public static void DrawOctogon()
        {
            //------------- Recipe for DrawOctogon

            // Do the following 8 times
            for (int i = 0; i < 8; i++)
            {
                // Change the color of the line the tortoise draws to the next color on the color wheel
                Tortoise.SetPenColor(ColorWheel.GetNextColor());
                // Move the tortoise 50 pixels
                Tortoise.Move(50);
                // Turn the tortoise 1/8th of 360 degrees to the right
                Tortoise.Turn(360 / 8);
                // Repeat    
            }

        }

    }
}